import com.kuang.pojo.Student;
import com.kuang.pojo.Teacher;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @功能：
 * @版本： V1
 * @版权： 信息技术有限公司（http://www.mychery.com/）
 * @作者： 磐石战队开发组  00355760
 * @日期： 2024/8/23 15:20
 */
public class mytest {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        Student bean = (Student) context.getBean("stu");
        System.out.println(bean.toString());

    }

    @Test
    public void test() {
        ApplicationContext context = new ClassPathXmlApplicationContext("teacher.xml");
        Teacher bean= context.getBean("tea", Teacher.class);
        Teacher bean2= context.getBean("tea", Teacher.class);
        System.out.println(bean.hashCode());
        System.out.println(bean2.hashCode());
        System.out.println(bean.toString());
    }
    @Test
    public void test2() {
        ApplicationContext context = new ClassPathXmlApplicationContext("teacher.xml");
        Teacher bean= context.getBean("teacher2", Teacher.class);
        Teacher bean2= context.getBean("teacher2", Teacher.class);
        System.out.println(bean.hashCode());
        System.out.println(bean2.hashCode());
        System.out.println(bean.toString());
    }
}
